package com.mvp.shq.washer.ui.shop.order.orderpay;

import com.mvp.shq.washer.entity.result.AlipayResult;
import com.mvp.shq.washer.entity.result.BaseResult;
import com.mvp.shq.washer.entity.result.WxPayResult;
import com.mvp.shq.washer.entity.shop.TotalOrderData;
import com.mvp.shq.washer.entity.shop.result.OrderDataListResult;
import com.mvp.shq.washer.entity.shop.result.OrderDataResult;
import com.mvp.shq.washer.entity.shop.result.ShopAliPayResult;
import com.mvp.shq.washer.http.RxSchedulers;
import com.mvp.shq.washer.http.ShopApi;

import io.reactivex.Observable;

/**
 * Created by westing on 2017/10/11.
 */

public class Model implements OrderPayConstract.Model {
    @Override
    public Observable<BaseResult<ShopAliPayResult>> getAlipayResult(String token, String orderNo, String payType) {
        return ShopApi.getInstance().service
                .getAlipayResult(token,orderNo,payType)
                .compose(RxSchedulers.io_main());
    }

    @Override
    public Observable<BaseResult<WxPayResult>> getWxResult(String token, String orderNo, String payType) {
        return ShopApi.getInstance().service
                .getWXResult(token,orderNo,payType)
                .compose(RxSchedulers.io_main());
    }

    @Override
    public Observable<BaseResult<OrderDataResult>> createOrder(String token, TotalOrderData ecTotalOrderDto) {
        return ShopApi.getInstance().service
                .createOrder(token,ecTotalOrderDto)
                .compose(RxSchedulers.io_main());
    }

    @Override
    public Observable<BaseResult<OrderDataListResult>> getOrderInfo(String token, String userId, String orderId) {
        return ShopApi.getInstance().service
                .getOrderDetail(token,userId,orderId)
                .compose(RxSchedulers.io_main());
    }


}
